package cn.lmxdev.iad.controller;

import cn.lmxdev.iad.util.IpUtil;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpServletRequest;
import java.net.InetAddress;
import java.net.UnknownHostException;

@Controller
public class IndexController {
    @GetMapping(value = "")
    public String indexPage(HttpServletRequest request, Model model) throws UnknownHostException {

        model.addAttribute("youIp", IpUtil.getIpAddr(request));
        model.addAttribute("meIp", InetAddress.getLocalHost().getHostAddress());

        return "index";
    }
}
